home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
012
/
keys.lqr
/
keys.lbr
/
keyfile.c
< prev
next >
Wrap
Text File
|
2011-02-04
|
1KB
|
52 lines
/* Creates header file keys.new with macros for recognizing special IBM keys */
/* Courtesy of Dr. Bob's Utilities 1985 */
#include f:defs.h
#include f:stdio.h
main()
{
int c;
char temp[20];
FILE *fp, *fopen();
printf("\n\nKEYFILE -- creates macro file KEYS.NEW to help\n");
printf("recognize IBM 'special' keys.\n\nMerge into your KEYS.H file.\n");
printf("Use with key.c (contains inch() and kb() functions).\n");
printf("\n\nCourtesy of Dr. Bob's Utilities - 1985\n\n");
fp = fopen("keys.new","w"); /* open keys.new for writing */
for(;;) {
printf("\n-------------------------\nEnter macro ('q' to quit): ");
gets(temp);
if ((*temp == 'q') || (*temp == 'Q')) {
fclose(fp);
exit();
}
printf("Press key macro refers to: ");
c = inch();
fprintf(fp,"#define %s %d\n",temp,c); /* write line to keys.new file */
}
}
inch() /* waits for & returns char from kb as int ascii value */
{
int c;
while ((c = kb()) == 0) /* wait for keypress */
;
return(c); /* return it */
}